<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>/net/nas/exports/srv/www/webapps/Projects/Java/CS222/Seminar_5/AssignmentTwo/src/Customer.java.html</title>
<meta name="Generator" content="Vim/7.1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000"><font face="monospace">
<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;*</font><font color="#6a5acd">&nbsp;Customer.java</font><br>
<font color="#0000ff">&nbsp;*</font><font color="#6a5acd">&nbsp;Develop a class with overloaded methods</font><br>
<font color="#0000ff">&nbsp;*</font><font color="#6a5acd">&nbsp;&nbsp; 1.</font><font color="#0000ff">&nbsp;Create a class called Customer.java</font><br>
<font color="#0000ff">&nbsp;*</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp; 2. Within the customer.java class, create a method called setCustomerInfo</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and add an overloaded method setCustomerInfo.</font><br>
<font color="#0000ff">&nbsp;*</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp; 3. Depending on how the setCustomerInfo method is called, it does one of</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the following:</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a) Sets the ID, name, address and phone no. for a Customer object</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (this is the minimum info. Needed for a new Customer)</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b) Sets the ID, name, address, phone no., and email address for a</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Customer object.</font><br>
<font color="#0000ff">&nbsp;*</font><br>
<font color="#0000ff">&nbsp;* </font><font color="#6a5acd">@author</font><font color="#0000ff">:&nbsp;&nbsp;John Thomason</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;Date:&nbsp;&nbsp;Dec 6, 2008 / 8:13:11 AM</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;Course:&nbsp;&nbsp;CS222 - Java Programming II</font><br>
<font color="#0000ff">&nbsp;* Seminar:&nbsp;&nbsp;5</font><br>
<font color="#0000ff">&nbsp;*&nbsp;&nbsp;Assign:&nbsp;&nbsp;2</font><br>
<font color="#0000ff">&nbsp;*/</font><br>
<br>
<br>
<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;*</font><font color="#6a5acd">&nbsp;Customer Class</font><br>
<font color="#6a5acd">&nbsp;</font><font color="#0000ff">*/</font><br>
<font color="#2e8b57"><b>public</b></font>&nbsp;<font color="#2e8b57"><b>class</b></font>&nbsp;Customer {<br>
<br>
<font color="#0000ff">//INSTANCE VARS</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>static</b></font>&nbsp;Integer gid = <font color="#ff00ff">101</font>;&nbsp;&nbsp; <font color="#0000ff">//global identifier</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;Integer id;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;String&nbsp;&nbsp;name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;address,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;phone,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email;<br>
<br>
<br>
<font color="#0000ff">//CONSTRUCTORS</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;Customer(){} <font color="#0000ff">//No default Customer</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Constructor with minimum property requirements</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;id</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer id (auto generated)</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;name</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;address</font><font color="#0000ff">&nbsp;&nbsp; The customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;phone</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;Customer(Integer id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;address,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;phone ){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setCustomerInfo(id,name,address,phone);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Constructor with all customer properties</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;id</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer id (auto generated)</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;name</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;address</font><font color="#0000ff">&nbsp;&nbsp; The customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;phone</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;email</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's email address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;Customer(Integer id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;address,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;phone,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;email ){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setCustomerInfo(id,name,address,phone,email);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//Customer Constructor</font><br>
<br>
<font color="#0000ff">//GETTERS</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;getId()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return this customer's identifier</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The id of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;Integer getId(){ <font color="#a52a2a"><b>return</b></font>&nbsp;id; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;getName()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return the customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The full name of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;String getName(){ <font color="#a52a2a"><b>return</b></font>&nbsp;name; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;getAddress()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return the customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The mailing address of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;String getAddress(){ <font color="#a52a2a"><b>return</b></font>&nbsp;address; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;getPhone()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return the customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The phone number of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;String getPhone(){ <font color="#a52a2a"><b>return</b></font>&nbsp;phone; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;getEmail()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return the customer's email address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The email address of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;String getEmail(){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>if</b></font>&nbsp;(<font color="#2e8b57"><b>this</b></font>.email == <font color="#ff00ff">null</font>){ <font color="#2e8b57"><b>this</b></font>.email = <font color="#ff00ff">&quot;&quot;</font>; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>return</b></font>&nbsp;<font color="#2e8b57"><b>this</b></font>.email;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//getEmail()</font><br>
<br>
<br>
<font color="#0000ff">//SETTERS</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setId()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Store the customer id or generate a new id</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;id</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;The attempted id</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setId(Integer id){<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">//if this customer does not have an id...</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>if</b></font>&nbsp;(<font color="#2e8b57"><b>this</b></font>.id == <font color="#ff00ff">null</font>){<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">//if the passed id is NOT valid...</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>if</b></font>&nbsp;(!id.equals(Customer.gid - <font color="#ff00ff">1</font>)){<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">//get a new ID</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id = Customer.newId();<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//inner if</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>this</b></font>.id = id;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//outer if</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//setId()</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setName()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Store the customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;name</font><font color="#0000ff">&nbsp;&nbsp;The full name of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setName(String name){ <font color="#2e8b57"><b>this</b></font>.name = name; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setAddress()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Store the customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;address</font><font color="#0000ff">&nbsp;&nbsp; The mailing address of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setAddress(String address){ <font color="#2e8b57"><b>this</b></font>.address = address; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setPhone()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Store the customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;phone</font><font color="#0000ff">&nbsp;The phone number of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setPhone(String phone){ <font color="#2e8b57"><b>this</b></font>.phone = phone; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setEmail()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Store the customer's email address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;email</font><font color="#0000ff">&nbsp;The email address of this customer</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>private</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setEmail(String email){ <font color="#2e8b57"><b>this</b></font>.email = email; }<br>
<br>
<br>
<font color="#0000ff">//OVERLOADED METHODS (REQUIRED)</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setCustomerInfo()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Stores the available customer information in this object</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;id</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer id (auto generated)</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;name</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;address</font><font color="#0000ff">&nbsp;&nbsp; The customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;phone</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setCustomerInfo(Integer id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;address,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;phone ){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setCustomerInfo(id,name,address,phone,<font color="#ff00ff">&quot;&quot;</font>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//setCustomerInfo()</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;setCustomerInfo()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Stores the available customer information in this object</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;id</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer id (auto generated)</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;name</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The customer's full name</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;address</font><font color="#0000ff">&nbsp;&nbsp; The customer's mailing address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;phone</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's phone number</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; * </font><font color="#6a5acd">@param</font><font color="#008b8b">&nbsp;email</font><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; The customer's email address</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;<font color="#2e8b57"><b>void</b></font>&nbsp;setCustomerInfo(Integer id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;address,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;phone,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;&nbsp;email ){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setId(id);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setName(name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAddress(address);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setPhone(phone);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setEmail(email);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//setCustomerInfo()</font><br>
<br>
<br>
<font color="#0000ff">//STATIC METHODS</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;newId()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Returns the next available global id, and increments</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;&nbsp;The next global id (gid)</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;<font color="#2e8b57"><b>static</b></font>&nbsp;Integer newId(){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>return</b></font>&nbsp;gid++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//newCustomerId()</font><br>
<br>
<br>
<font color="#0000ff">//OVERRIDDEN METHODS</font><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">/**</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;toString()</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><font color="#6a5acd">&nbsp;Return a string representing a customer object</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; *</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#0000ff">* </font><font color="#6a5acd">@return</font><font color="#0000ff">&nbsp;The customer information as a string</font><br>
<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; */</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a020f0">@Override</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2e8b57"><b>public</b></font>&nbsp;String toString(){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#a52a2a"><b>return</b></font>&nbsp;String.format(<font color="#ff00ff">&quot;Customer:</font><font color="#6a5acd">\n</font><font color="#ff00ff">&quot;</font>&nbsp;+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff00ff">&quot;&nbsp;&nbsp;CUST%05d -- %s</font><font color="#6a5acd">\n</font><font color="#ff00ff">&quot;</font>&nbsp;+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff00ff">&quot;&nbsp;&nbsp;%s</font><font color="#6a5acd">\n</font><font color="#ff00ff">&quot;</font>&nbsp;+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff00ff">&quot;&nbsp;&nbsp;%s</font><font color="#6a5acd">\n</font><font color="#ff00ff">&quot;</font>&nbsp;+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff00ff">&quot;&nbsp;&nbsp;%s</font><font color="#6a5acd">\n</font><font color="#ff00ff">&quot;</font>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getId(),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getName(),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getAddress(),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getPhone(),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getEmail()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); <br>
&nbsp;&nbsp;&nbsp;&nbsp;}<font color="#0000ff">//toString()</font><br>
<br>
}<font color="#0000ff">//end Customer class</font><br>
</font></body>
</html>
